package cn.hwm.proxy.socketio;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;

/**
 * 客户端，发送数据
 */
public class Client {

    public static void main(String[] args) throws Exception {
        InetSocketAddress bindPoint = new InetSocketAddress("192.168.2.223", 5050);

        Socket socket = new Socket();
        socket.connect(bindPoint);

        // 读取服务器端数据
        DataInputStream dis = new DataInputStream(socket.getInputStream());
        System.out.println(dis.readUTF());

        // 发送客户端数据
        DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
        dos.writeUTF("数据流接收得到不");
        dos.writeUTF("数据流接收得到不2");

        dis.close();
        dos.close();
        socket.close();
    }

}
